project(Calligrapher)

find_package(PkgConfig)

pkg_check_modules(CAIRO "cairo")

set(JTK_LIBRARY_DIRS "${Calligrapher_SOURCE_DIR}/../build/jtk")
set(JTK_INCLUDE_DIRS "${Calligrapher_SOURCE_DIR}/../jtk")

find_library(CAIRO_LIBRARY cairo ${CAIRO_LIBRARY_DIRS})
find_library(JTK_LIBRARY jtk ${JTK_LIBRARY_DIRS})

# Hack: to be safe, we should use ${CAIRO_LIBRARIES} here, 
# but I just don't want to link with those unused libs.
set(EXTRA_LIBS         ${CAIRO_LIBRARY}      ${JTK_LIBRARY})
set(EXTRA_LIB_DIRS     ${CAIRO_LIBRARY_DIRS} ${JTK_LIBRARY_DIRS})
set(EXTRA_INCLUDE_DIRS ${CAIRO_INCLUDE_DIRS} ${JTK_INCLUDE_DIRS})

set(CALLIGRAPHER_SOURCES calligrapher.c strokes.c)

link_directories(${EXTRA_LIB_DIRS})
include_directories(${EXTRA_INCLUDE_DIRS})

add_executable(calligrapher ${CALLIGRAPHER_SOURCES})
target_link_libraries(calligrapher ${EXTRA_LIBS})

